/*
 */



function FadeOpacity(elemId, fromOpacity, toOpacity, time, fps)
{
   var steps = Math.ceil(fps * (time / 1000));
   var delta = (toOpacity - fromOpacity) / steps;
   FadeOpacityStep(elemId, 0, steps, fromOpacity,delta,(time / steps));
}

function FadeOpacityStep(elemId, stepNum, steps, fromOpacity,delta, timePerStep)
{
    SetOpacity(document.getElementById(elemId),Math.round(parseInt(fromOpacity) + (delta * stepNum)));
    if (stepNum < steps)
        setTimeout("FadeOpacityStep('" + elemId + "', " + (stepNum+1) + ", " + steps + ", " + fromOpacity + ", " + delta + ", " + timePerStep + ");", timePerStep);
}

function SetOpacity(elem, opacityAsInt)
{
    var opacityAsDecimal = opacityAsInt;
    if (opacityAsInt > 100)
        opacityAsInt = opacityAsDecimal = 100; 
    else if (opacityAsInt < 0)
        opacityAsInt = opacityAsDecimal = 0; 
    opacityAsDecimal /= 100;
    if (opacityAsInt < 1)
        opacityAsInt = 1; // IE7 bug, text smoothing cuts out if 0
    elem.style.opacity = (opacityAsDecimal);
    elem.style.filter  = "alpha(opacity=" + opacityAsInt + ")";
}

function Minimized(p)
{
    //document.getElementById('jx-bar').style.display = "none";
    //Expand
    var e  = document.getElementById(p);
    if (e.style.display == "")
    {
        //Minimized
        e.style.display = "none";
        document.getElementById('jx-bar').className = "jx-bar-min";
        document.getElementById('jx-bar').style.opacity = 0.8;
        document.getElementById('jx-bar').style.filter = "alpha(opacity=80)";
        document.getElementById('lnkMinimized').innerHTML = "<img src='/App_Themes/Default/images/e.png' alt='Expand'/>";    
    }
    else {
        e.style.display = "";
        document.getElementById('jx-bar').className = "jx-bar";
        document.getElementById('lnkMinimized').innerHTML = "<img src='/App_Themes/Default/images/m.png' alt='Minimized'/>";
    }
    return false;
}

function strike(e)
{
    var p = document.getElementById('DanhSachCauHoi');
    var arr = p.getElementsByTagName('a');
    for (var i = 0; i < arr.length; i++)
    {
        if (arr[i].rel == e.name)
        {
            arr[i].className = "strike";
        }
    }
}

function ChkState(e)
{
    var inputs = document.getElementsByTagName("input");
    for (var i = 0; i < inputs.length; i++)
    {
        if (inputs[i].type == 'radio' && inputs[i].className == 'styled' && inputs[i].checked == true)
        {
            strike(inputs[i]);
        }
    }
    Finish(e);
}
function Finish(e)
{
    var s = document.getElementById(e).value;
    var a = new Array();
    a = s.split(',');
    for (var i = 0; i < a.length; i++)
    {
        highlight(a[i]);
    }
    document.getElementById('btnNopBai2').disabled = true;
}

function highlight(a)
{
    var p = document.getElementById('DanhSachCauHoi');
    var arr = p.getElementsByTagName('a');
    for (var i = 0; i < arr.length; i++)
    {
        if (arr[i].rel == a)
        {
            arr[i].className = "highlight";
        }
    }
}